#!/usr/bin/env ruby

boot_location = [
  ["#{File.dirname(__FILE__)}/../config/boot.rb", ".."],
  ["#{File.dirname(__FILE__)}/boot.rb", "."]
].find{|path, root| File.file? path}

APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), boot_location.last))
require boot_location.first

Reactive.init(:configure, ARGV + ['--root', APP_ROOT])

require 'rubigen'
require 'rubigen/scripts/destroy'

ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_plugin_sources! [:reactive, :reactive_app, :test_unit]
RubiGen::Scripts::Destroy.new.run(ARGV)
